/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.banconacion.servlet;

import com.banconacion.bean.ClienteDTO;
import com.banconacion.service.GestionaClienteService;
import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
 *
 * @author igorov
 */
public class MostrarBusqueda extends HttpServlet {
    private static final long serialVersionUID = 2652225997622140246L;
    private GestionaClienteService gestionaClienteService = new GestionaClienteService();

//    SolicitudApertura.jsp
    protected void service(
            HttpServletRequest request,
            HttpServletResponse response)
            throws ServletException, IOException {
        String rucBusqueda = request.getParameter("rucBusqueda");
        
        try {
            ClienteDTO clienteDTO = gestionaClienteService.obtenerClientePorRuc(rucBusqueda);
            request.setAttribute("cliente", clienteDTO);
            
        } catch (Exception e) {
            String mensaje = "Usuario o password incorrecto";
            request.setAttribute("mensajeError", mensaje);
        }
        request.getRequestDispatcher("/pages/SolicitudApertura.jsp").forward(request, response);
    }
}
